package com.netsdk.controller;

import com.netsdk.common.DaHuaDevice;
import com.netsdk.entity.JsonData;
import com.netsdk.service.DeviceInterface;
import com.netsdk.service.impl.DeviceImpl;
import com.netsdk.utils.AutoRegister;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/device")
public class DaHuaDeviceController {

    @Autowired
    private DeviceImpl device;

    //下发人员
    @PostMapping("/addPerson")
    public JsonData addPerson(@RequestBody Map<String,Object> paramMap){
        //0添加人员，1修改人员
        return device.updatePerson(paramMap,0);
    }

    //修改人员
    @PostMapping("/updatePerson")
    public JsonData updatePerson(@RequestBody Map<String,Object> paramMap){
        //0添加人员，1修改人员
        return device.updatePerson(paramMap,1);
    }

    //删除人员
    @PostMapping("/deletePerson")
    public JsonData deletePerson(@RequestBody Map<String,Object> paramMap){
        return device.deletePerson(paramMap);
    }

    //下发人脸
    @PostMapping("/addFace")
    public JsonData addFace(@RequestBody Map<String,Object> paramMap){
        return device.addFace(paramMap);
    }

    //远程开门
    @GetMapping("/open")
    public JsonData open(String serialNumber){
        return device.open(serialNumber);
    }

}
